package com.example.service;

import io.seata.rm.tcc.api.BusinessActionContext;
import io.seata.rm.tcc.api.BusinessActionContextParameter;
import io.seata.rm.tcc.api.LocalTCC;
import io.seata.rm.tcc.api.TwoPhaseBusinessAction;

@LocalTCC
public interface StockTccService {

    @TwoPhaseBusinessAction(
        name = "reduce", 
        commitMethod = "confirm", 
        rollbackMethod = "cancel"
    )
    void reduce(
        @BusinessActionContextParameter(paramName = "productId") Integer productId,
        @BusinessActionContextParameter(paramName = "count") Integer count
    );
    
    boolean confirm(BusinessActionContext context);
    
    boolean cancel(BusinessActionContext context);
}